package com.example.membersteward.controller;

import com.example.membersteward.common.CommonResult;
import com.example.membersteward.entity.User;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/api")
public class TestController {


    @RequestMapping("/info")
    public CommonResult test() {
        User user = (User) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
        System.out.println(user.getUserAcct());
        return CommonResult.success("测试成功"+user.getUsername());
    }
}
